//
//  SuppliersItem.swift
//  weile
//
//  Created by LKM on 17/1/16.
//  Copyright © 2017年 LKM. All rights reserved.
//

import UIKit
import Kingfisher

class SuppliersItem:UITableViewCell{
    /**
    @IBOutlet weak var bottomViewLeftLC: NSLayoutConstraint!
    @IBOutlet weak var nameRoundBgViewLeftLC: NSLayoutConstraint!
    @IBOutlet weak var bottomViewWidthLC: NSLayoutConstraint!
    @IBOutlet weak var nameRoundBgView: UIView!
 **/
    
    @IBOutlet weak var img_head: UIImageView!
    
    var mArticlesItemTo:ArticlesItemTo! {
        
        didSet{
            img_head.contentMode=UIViewContentMode.scaleAspectFit
            img_head.kf.setImage(with: URL(string: Api.getImageUrl(mArticlesItemTo.ImgUrl ?? "" ) ), placeholder: Image(named: "PlaceHolderImage_small"), options: nil, progressBlock: nil) { (image, error, cacheType, imageURL) in
                if error == nil {
                    self.img_head.contentMode=UIViewContentMode.scaleAspectFill
                }
            }
            
            
            
        }
    }
    
    var curIndex:Int! {
        didSet{
            /**if(curIndex%2==0){
                //圆在 右
                nameRoundBgViewLeftLC.constant=bottomViewWidthLC.constant + 10;//10是右边padding
                bottomViewLeftLC.constant = 10 ;
            }else{
                bottomViewLeftLC.constant = nameRoundBgView.width + 10 + 10;
                nameRoundBgViewLeftLC.constant = 10;
            }
            **/
        }
    }
    
    static func  getHeigth() ->CGFloat {
        
        /// 屏幕的宽
        let SCREENW = UIScreen.main.bounds.size.width
        
        let imageW=SCREENW-8-8;
        let imageH=imageW/1.46
        
        let cellH=imageH+8;
        
//        cellH += 68;//这个是底部的
        
        return cellH;
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        //设置cell透明
        backgroundColor = UIColor.clear;
        
        img_head.layer.cornerRadius=2;
        //img_head.layer.borderColor = R.colors.base_color.cgColor
        //img_head.layer.borderWidth = 1
        
        /**
        nameRoundBgView.layer.cornerRadius=nameRoundBgView.width/2;
        nameRoundBgView.layer.borderWidth=2;
        nameRoundBgView.layer.borderColor=UIColor.white.cgColor;
        nameRoundBgView.layer.backgroundColor = nameRoundBgView.backgroundColor?.cgColor;
        //宽
        bottomViewWidthLC.constant = ViewHelp.getScreenWidth() - nameRoundBgView.width - 20; //24是padding
        **/
        
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
}
